Polar code is a coding technology that draws increasing attention in recent years. The polar code constructs a compound channel and changes a feature of an original channel, so that a capacity of the compound channel is much closer to a high or low pole. Therefore, this coding technology is referred to as “polar code”. Because of this feature, with an appropriate coding design, the polar code is applicable to a randomly distributed original channel, and reach good performance and approach a channel capacity in various channel implementations. In addition, by means of interference cancellation decoding, the polar code can greatly reduce receiver complexity and facilitate receiver implementation.
An existing polar code encoder usually uses a fixed coding structure, a fixed quantity of effective input bits, and a fixed quantity of effective output bits. In theory, once a structure of a polar code encoder is determined, a quantity of input bits (or a length of input bits) of the polar code encoder is determined. However, because each input port of the polar code encoder corresponds to a different compound channel condition and it is inappropriate to use a port in a poor condition to transmit effective data, input bits of the polar code encoder are further classified into effective data bits and frozen bits. The frozen bits correspond to an input port that is of a compound channel and that is in a poor condition, and are fixed bits known to a receive end, for example, all zeroes, and may serve as prior information to help the receiver in decoding.
To use a hardware accelerator in implementation, the polar code encoder usually implements the frozen bits by using an internal structure, and external input of the polar code encoder is effective input bits of a fixed length. In an actual application, a size of a data block that needs to be transmitted is unfixed, and is usually unequal to a quantity of effective input bits of the polar code encoder. When a data block is relatively large, segmented coding may be performed. However, when a quantity of effective information bits of a code block is less than a quantity of effective input ports of the polar code encoder, coding cannot be performed by using the polar code. As a result, the code block cannot be transmitted by using the polar code.